import request from '@/utils/request.js'

export const sendCodeService = email =>
  request.get(`/api/user/public/email/send-code?email=${email}`)

export const verifyCodeService = (email, code) =>
  request.post(`/api/user/public/email/check-code`, { email, code })

export const registerService = ({ email, password, code }) =>
  request.post('/api/user/public/register', { email, password, code })

export const loginService = ({ email, password }) =>
  request.post('/api/user/public/login', { email, password })

export const useSpaceService = () => request.get('/api/user/private/use-space')

export const resetPasswordService = (email, password, code) =>
  request.post('/api/user/public/reset-password', { email, password, code })

export const logoutService = () => request.post('/api/user/private/logout')
